<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="../../../commons/taglib.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>药品检测</title>
	<link rel="stylesheet" href="${ctx}/static/css/pintuer.css">
    <link rel="stylesheet" href="${ctx}/static/css/admin.css">
    <link rel="stylesheet" href="${ctx}/static/css/bootstrap.min.css">
    <script src="${ctx}/static/js/jquery.js"></script>
    <script src="${ctx}/static/js/pintuer.js"></script>
	<script src="${ctx}/static/js/bootstrap.min/js/bootstrap.min.js"></script>
	<script src="${ctx}/static/js/bootstrap.min/js/jquery-1.11.1.min.js"></script>
	<script src="${ctx}/static/js/bootstrap.min/js/bootstrap.js"></script>
</head>
<body>
<form method="post" action="excel">
	<div class="panel admin-panel">
		<div class="panel-head">
			<!-- <strong class="icon-reorder"> 挂号管理</strong> -->
			<select style="padding:5px 15px; border:1px solid #ddd;" onchange="change(this.value)">
            <option value="detection" selected="selected">动态库存</option>
          	</select>
			<div style="float: right;">
				<button class="button border-main excel" type="submit"> 导出Excel</button>
			    <a class="button border-main" href="drugadmin"> 刷新</a>
			</div>
			<div style="clear: both;"></div>
		</div>
		<div class="padding border-bottom">
			<ul class="search" style="padding-left:10px;">
				<li>
					<input  class="input" name="ID_search" value="" placeholder="请输入药品名称(ID)" id="ID_search" required ="required"/>
				</li>
				<li>
					<input type="date" class="input" name="user_date" value="2015-03-27" id="date_search"/>
				</li>
				<li>
				<a class="button border-main" href="JavaScript:;" onclick="location ='search?ID_date='+document.getElementById('ID_search').value;"> 查询</a>
				</li>
			</ul>
		</div>
		<table class="table table-hover text-center" id="table">
		<c:if test="${ drugadmin != null }">
		<tr>
			<th width="8%" style="text-align:left; padding:10px 0;padding-left:20px;border-bottom: 2px solid #ddd;border-top: 0px solid #ddd;font-weight: bold;"> ID </th>
			<th style="text-align: center;" width="14%">操作</th>
			<th style="text-align: center;" width="14%">名称</th>
			<th style="text-align: center;">规格</th>
			<th style="text-align: center;">数量</th>
			<th style="text-align: center;" width="10%">进货价</th>
			<th style="text-align: center;" width="10%">零售价</th>
			<th style="text-align: center;" width="15%">有效期</th>
			<th style="text-align: center;" width="15%">产地</th>
			<th style="text-align: center;" width="15%">生产日期</th>
			<th style="text-align: center;" width="15%">入库人员</th>
			<th style="text-align: center;" width="15%">审核日期</th>
		</tr>
		</c:if>
		<c:forEach items="${drugadmin}" var="list">
			<tr>
				<td style="text-align:left; padding-left:20px;border-bottom: 1px solid #ddd;"><input type="hidden" name="id" value="${list.id }" /> ${list.id }</td>
				<td ><span onclick="update(${list.id })"><a  class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" style="cursor: pointer" >修改</a></span></td>
				<td style="border-bottom: 1px solid #ddd;"><input type="hidden" name="category" value="${list.name }"/>${list.name }</td>
				<td style="border-bottom: 1px solid #ddd;"><input type="hidden" name="name" value="${list.spec }"/>${list.spec }</td>
				<td style="border-bottom: 1px solid #ddd;"><input type="hidden" name="do_name" value="${list.tory }"/>${list.tory }</td>
				<td style="border-bottom: 1px solid #ddd;"><input type="hidden" name="sex" value="${list.p_price }"/>${list.p_price }</td>
				<td style="border-bottom: 1px solid #ddd;"><input type="hidden" name="fee" value="${list.price }"/>${list.price }</td>
				<td style="border-bottom: 1px solid #ddd;"><input type="hidden" name="deal" value="${list.yx_date }"/>${list.yx_date }</td>
				<td style="border-bottom: 1px solid #ddd;"><input type="hidden" name="deal" value="${list.region }"/>${list.region }</td>
				<td style="border-bottom: 1px solid #ddd;"><input type="hidden" name="deal" value="${list.sc_date }"/>${list.sc_date }</td>
				<td style="border-bottom: 1px solid #ddd;"><input type="hidden" name="deal" value="${list.ad_name }"/>${list.ad_name }</td>
				<td style="border-bottom: 1px solid #ddd;"><input type="hidden" name="deal" value="${list.sh_date}"/>${list.sh_date }</td>
			</tr>
		</c:forEach>
		<c:if test="${ pageNumber!=null }">
			<tr>
				<td colspan="7">
					<div class="pagelist">
						<a href="drugadmin?pageNumber=1">首页</a>
						<%-- <%if(){} %> --%>
						<c:if test="${ 1 != pageNumber && pageNumber >0 }">
							<a href="drugadmin?pageNumber=${pageNumber-1 }">上一页</a>
						</c:if>
						
						<c:if test="${ 0 != pageNumber-1 && 1 != pageNumber-1 && pageNumber >0 }">
							...
						</c:if>
						
						<c:if test="${ 1 != pageNumber && pageNumber >0 }">
							<a href="drugadmin?pageNumber=${pageNumber-1 }">${pageNumber-1 }</a>
						</c:if>
						
						<a href="inventory?pageNumber=${pageNumber }">${pageNumber }</a>
						
						<c:if test="${ Pages != pageNumber && pageNumber >0 }">
							<a href="drugadmin?pageNumber=${pageNumber+1 }">${pageNumber+1 }</a>
						</c:if>
						
						<c:if test="${ Pages != pageNumber && Pages != pageNumber+1 && pageNumber >0 }">
							...
						</c:if>
						
						<c:if test="${Pages != pageNumber && pageNumber >0 }">
							<a href="drugadmin?pageNumber=${pageNumber+1 }">下一页</a>
						</c:if>
						
						<a href="drugadmin?pageNumber=${Pages }">尾页</a>
						第${pageNumber }页/共${Pages }页
					</div>
				</td>
			</tr>
		</c:if>
		</table>
	</div>
</form>


<!-- Modal -->
<div style="width: 1000px;height: 800px;top:-170px;position:relative" id="div1">
<div class="modal-dialog modal-lg"  role="document"  >
	    <div class="modal-content">	
	     <div class="modal-header" style="background-color:#CCECED;">
	       <button type="button" class="close" data-dismiss="modal" aria-label="Close" id="gb1"></button>
	        <h4 class="modal-title" id="updateModalLabel" style="text-align:center;">修改药品</h4>
	      </div>
	      <div class="modal-body" id="update_body">
	     	<c:forEach items="${yao}" var="list">
	     	 <form id="unitform"  action="update_update" method="post">
	      	<input name="unit.aid" id="unit_aid" type="hidden" value="">
	      	<input name="unit.ylfwjgSid" id="unit_ylfwjgSid" type="hidden" value="70042">
	      	<input name="unit.ypksid" id="unit_ypksid" type="hidden" value="1148">
	      	<input name="unit.ggid" id="unit_ggid" type="hidden" value="111335">
	      	<input name="unit.jlzt" id="unit_jlzt" type="hidden" value="Y">
	      	<table class="table table-condensed" id="update">
	      	<tbody>
	      	<tr align="left">
	      		<td>
	      		<div class="input-group has-success">
	      		<span class="input-group-addon">批&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;次</span>
	      		<input   type="text" value="${list.id} " readOnly="true" name="id" class="form-control" aria-describedby="inputGroupSuccess3Status"></div></td>
	      		<td><div class="input-group has-success"><span class="input-group-addon">库存数量</span>
	      		<input   type="text" name="unit.kcsl" class="form-control" value="${list.tory} " readOnly="true"></div></td>
	      		<td><div class="input-group has-success"><span class="input-group-addon">拟&nbsp;&nbsp;用&nbsp;&nbsp;量</span>
	      		<input   type="text" name="unit.nyl" class="form-control" ></div></td></tr>
	      		<tr align="left"><td><div class="input-group has-success"><span class="input-group-addon">产&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;地</span>
	      		<input   type="text" name="unit.cd" class="form-control" value="${list.region} " readOnly="true"></div></td><td>
	      		<div class="input-group has-success"><span class="input-group-addon">批&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号</span>
	      		<input   type="text" name="unit.ph" class="form-control" value="${list.id} " readOnly="true"></div></td>
	      		<td><div class="input-group has-success"><span class="input-group-addon">加&nbsp;&nbsp;成&nbsp;&nbsp;率</span>
	      		<input   type="text" name="unit.jcl" class="form-control" ></div></td></tr>
	      		<tr align="left"><td><div class="input-group has-success"><span class="input-group-addon">进&nbsp;&nbsp;货&nbsp;&nbsp;价</span>
	      		<input   type="text" name="unit.ypjhj" class="form-control" value="${list.p_price} " readOnly="true"></div></td>
	      		<td><div class="input-group has-success"><span class="input-group-addon">批&nbsp;&nbsp;发&nbsp;&nbsp;价</span>
	      		<input   type="text" name="unit.yppfj" class="form-control" value="${list.p_price} " readOnly="true"></div></td>
	      		<td><div class="input-group has-success"><span class="input-group-addon">零&nbsp;&nbsp;售&nbsp;&nbsp;价</span>
	      		<input   type="text" name="unit.yplsj" class="form-control" value="${list.price} " readOnly="true"></div></td>
	      		</tr><tr align="left"><td><div class="input-group has-success"><span class="input-group-addon" readOnly="true">批准文号</span>
	      		<input  value="${list.id} " readOnly="true" type="text" name="unit.pzwh" class="form-control" ></div></td>
	      		<td><div class="input-group has-success"><span class="input-group-addon">新到药品</span>
	      		<select id="unit_xdyp" name="new_yao" class="form-control">
	      			<option value="是">是</option>
	      			<option value="否">否</option>
	      		</select></div></td><td>
	      		<div class="input-group has-success"><span class="input-group-addon">当前状态</span>
	      		<select id="unit_ytzt" name="state" class="form-control">
	      		<option value="正常">正常</option>
	      		<option value="停用">停用</option></select></div></td></tr>
	      		<tr align="left"><td><div class="input-group has-success"><span class="input-group-addon">自动分装</span>
	      		<select id="unit_zdfz" name="unit.zdfz" class="form-control">
	      		<option value="1">是</option><option value="0">否</option>
	      		</select></div></td><td><div class="input-group has-success">
	      		<span class="input-group-addon">是否免费</span>
	      		<select id="unit_mfyp" name="mf" class="form-control">
	      		<option value="否">否</option>
	      		<option value="是">是</option></select></div></td><td><div class="input-group has-success"><span class="input-group-addon">使用状态</span>
	      		<input value="良好" readOnly="true" type="text" name="unit.syzt" class="form-control" aria-describedby="inputGroupSuccess3Status"></div></td></tr><tr align="left"><td>
	      		<div class="input-group has-success"><span class="input-group-addon">监控状态</span>
	      		<input value="${list.id} " readOnly="true" type="text" name="unit.jkzt" class="form-control" ></div></td><td><div class="input-group has-success">
	      		<span class="input-group-addon">失效日期</span>
	      		<input  value="${list.yx_date} " readOnly="true" name="unit.sxrq" type="text" class="form-control" ></div></td><td><div class="input-group has-success">
	      		<span class="input-group-addon">货&nbsp;&nbsp;位&nbsp;&nbsp;号</span>
	      		<input value="${list.id} " readOnly="true" type="text" name="unit.hwh" class="form-control" ></div></td></tr><tr align="left"><td><div class="input-group has-success">
	      		<span class="input-group-addon">库存上限</span>
	      		<input  value="${list.yao_upper} " type="text" name="yao_upper" class="form-control" ></div></td>
	      		<td><div class="input-group has-success">
	      		<span class="input-group-addon">库存下限</span>
	      		<input value="${list.lower_upper}" type="text" name="lower_upper" class="form-control" ></div></td></tr></tbody></table>
	      			<div class="modal-footer" style="text-align:center;">
	        		<button type="button" class="btn btn-default" data-dismiss="modal" id="gb2">关闭</button>
	        		<button type="submit" class="btn btn-default">保存</button>
	      		</div>
	      		</form>
	      		</c:forEach>
	      		</div>
	 	    
	    </div>
	  </div></div>
<script type="text/javascript">

function change(data){
	window.location=data;
};
		function update(id){
		
			location='update?id='+id
			console.log(id);
		}
		
		$("#gb1").on('click',function(){
			document.getElementById("div1").style.display="none";
			location ='drugadmin'
		})
		$("#gb2").on('click',function(){
			document.getElementById("div1").style.display="none";
			location ='drugadmin'
		})
	
</script>
</html>